From 45ee9cdba4e6e7c9ac918859b89d2b2ed38d4571 Mon Sep 17 00:00:00 2001
From: Chris Johnston <christopher_johnston@me.com>
Date: Thu, 11 Jan 2024 21:38:30 +0000
Subject: Assign categories to expenses (#28)

* add expense categories

* set category to Payment for reimbursements

* Insert categories as part of the migration

* Display category groups

---------

Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
---
 src/app/groups/[groupId]/expenses/create/page.tsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src/app/groups/[groupId]/expenses/create/page.tsx')

diff --git a/src/app/groups/[groupId]/expenses/create/page.tsx b/src/app/groups/[groupId]/expenses/create/page.tsx
index e603e59..405db26 100644
--- a/src/app/groups/[groupId]/expenses/create/page.tsx
+++ b/src/app/groups/[groupId]/expenses/create/page.tsx
@@ -1,5 +1,5 @@
 import { ExpenseForm } from '@/components/expense-form'
-import { createExpense, getGroup } from '@/lib/api'
+import { createExpense, getGroup, getCategories } from '@/lib/api'
 import { expenseFormSchema } from '@/lib/schemas'
 import { Metadata } from 'next'
 import { notFound, redirect } from 'next/navigation'
@@ -13,6 +13,7 @@ export default async function ExpensePage({
 }: {
   params: { groupId: string }
 }) {
+  const categories = await getCategories()
   const group = await getGroup(groupId)
   if (!group) notFound()
 
@@ -23,5 +24,5 @@ export default async function ExpensePage({
     redirect(`/groups/${groupId}`)
   }
 
-  return <ExpenseForm group={group} onSubmit={createExpenseAction} />
+  return <ExpenseForm group={group} categories={categories} onSubmit={createExpenseAction} />
 }
-- 
cgit v1.3

